# -=- encoding: utf-8

from django.contrib import admin
from adl.board.models import *

class ForumCategoryAdmin(admin.ModelAdmin):
    list_display = ('name', 'description',)
    ordering = ('name',)
    filter_horizontal = ('min_rank_read', 'min_rank_write', 'min_rank_moderate', )
admin.site.register(ForumCategory, ForumCategoryAdmin)

class ForumAdmin(admin.ModelAdmin):
    list_display = ('name', 'description', 'category_link', )
    ordering = ('name',)
admin.site.register(Forum, ForumAdmin)

class PostInline(admin.TabularInline):
    model = Post
    # fk_name = 'thread'
    # formset  This defaults to BaseInlineFormSet.
    verbose_name = "Posting"
    verbose_name_plural = "Postings"

class ThreadAdmin(admin.ModelAdmin):   
    list_display = ('title', 'forum_link', 'category_link', 'is_sticky')
    list_filter = ('is_sticky',)
    ordering = ('created',)
    inlines = [PostInline, ]
admin.site.register(Thread, ThreadAdmin)